package com.test;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;

//@WebServlet(name = "AllServlet", value = "/*")
public class AllServlet extends HttpServlet {
    //springMVC是通过一个核心控制器servlet 对所有的路径进行处理
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        //获取请求的路径
        String requestURI = request.getRequestURI();
        //基于路径获取spring容器中的对应对象 调用对应方法
        if(AllController.hashMap.get(requestURI)!=null){
            System.out.println(AllController.hashMap.get(requestURI)+"方法执行");
        }else{
            System.out.println("请求的路径:"+requestURI+"没有对应的方法执行");
        }
    }
}